package com.example.rentingapp.activity;

import android.view.View;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.ListView;

import com.example.rentingapp.R;
import com.example.rentingapp.adapter.CollectionAdapter;
import com.example.rentingapp.enetity.Collection;

import java.util.LinkedList;
import java.util.List;

public class MyCollectionActivity extends BaseActivity {
    private CollectionAdapter collectionAdapter = null;
    private ImageView iv_Back;
    private List<Collection> mcollection = null;
    private ListView listView;


    @Override
    protected int initLayout() {
        return R.layout.activity_my_collection;
    }

    @Override
    protected void initView() {
        listView = findViewById(R.id.lv_collection);
        iv_Back = findViewById(R.id.iv_back);
    }

    @Override
    protected void initData() {
        mcollection = new LinkedList<>();
        int i = 0;

        mcollection.add(new Collection("房屋位置---房屋位置---房屋位置---房屋位置" + i, "长租短租" + i, "整租合租" + i, "房屋租金" + i * 1000, R.mipmap.img_houses));

        collectionAdapter = new CollectionAdapter(mcollection, mContext);
        listView.setAdapter(collectionAdapter);
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
//                navigateTo(HousingDetailsActivity1.class);
            }
        });
        //返回按钮
        iv_Back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }
}